﻿using System;
namespace Producers.Kis.Xtee.Riik.Ee.Producer.Kis {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="ClaimBase_Claim", Namespace="http://producers.kis.xtee.riik.ee/producer/kis", Target=typeof(ClaimBaseClaim))]
    public class ClaimBaseClaimSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IClaimBaseClaim clazz;
        
        public ClaimBaseClaimSerializer(IClaimBaseClaim clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("ClaimID");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.ClaimID))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("ClaimBaseID");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.ClaimBaseID))).ToString());
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="ClaimID") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>ClaimBase_Claim>ClaimID");
                }
                clazz.ClaimID = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("ClaimID")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>ClaimBase_Claim>ClaimID", Reader.LocalName);
            }
            if (Reader.LocalName=="ClaimBaseID") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>ClaimBase_Claim>ClaimBaseID");
                }
                clazz.ClaimBaseID = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("ClaimBaseID")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>ClaimBase_Claim>ClaimBaseID", Reader.LocalName);
            }
        }
    }
}
